# class Solution(object):
#     def generate(self, numRows):
#         """
#         :type numRows: int
#         :rtype: List[List[int]]
#         """
#         res = list()
#         for i in range(numRows):
#             row = list()
#             for j in range(0, i+1):
#                 if j == 0 or j == i:
#                     row.append(1)
#                 else:
#                     row.append(res[i-1][j] + res[i-1][j-1])
#             res.append(row)
#         print(res)
class Solution:
    def generate(self, numRows):
        ret = []
        for i in range(numRows):
            row = []
            for j in range(0, i + 1):
                if j == 0 or j == i:
                    row.append(1)
                else:
                    row.append(ret[i - 1][j] + ret[i - 1][j - 1])
            ret.append(row)
            print(ret)


if __name__ == '__main__':
    oo = Solution()
    oo.generate(5)
